<template>
  <div class="mainNews">
    <van-nav-bar
      title="社区新闻"
      left-text=""
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="newsList">
      <div v-for="(i, index) in newsList" :key="index">
        <div class="card">
          <div class="card-main">
            <div class="card-main-title">{{ i.title }}</div>
            <div class="card-main-author">{{ i.author }}</div>
            <div class="card-main-desc">{{ i.desc }}</div>
          </div>
          <img v-bind:src="i.img" class="image" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "News",
  components: {},
  data() {
    return {
      backAddr: "/community",
      newsList: [
        {
          title: "成年人的快乐六一",
          author: "人民资讯",
          desc:'小时候总是盼望着长大，长大后大人们却又开始装孩子。或许在年龄...',
          img: require("../assets/news/1.jpg"),
        },
        {
          title: "2021高考天气地图出炉",
          author: "中国天气网",
          desc:'2021年高考大幕即将开启。高考期间将会遇到什么天气？快收下这份2021高考...',
          img: require("../assets/news/2.jpg"),
        },
        {
          title: "台湾新增511例本土病例",
          author: "环球网",
          desc:'台湾流行疫情指挥中心6月5日公布，台湾新增511例新冠肺炎...',
          img: require("../assets/news/3.jpg"),
        },
        {
          title: "成年人的快乐六一",
          author: "人民资讯",
          desc:'小时候总是盼望着长大，长大后大人们却又开始装孩子。或许在年龄...',
          img: require("../assets/news/1.jpg"),
        },
        {
          title: "成年人的快乐六一",
          author: "人民资讯",
          desc:'小时候总是盼望着长大，长大后大人们却又开始装孩子。或许在年龄...',
          img: require("../assets/news/1.jpg"),
        },
      ],
    };
  },
  methods: {
    onClickLeft() {
      this.$router.push({ path: this.backAddr });
    },
  },
};
</script>

<style lang="scss" >
body {
  background-color: #f6f7f7;
}
.mainNews {
  margin: 0;
  width: 375px;
}
.title {
  color: white;
  height: 50px;
  width: 100%;
  background-color: #64b587;
  display: flex;
  align-items: center;
  span {
    font-size: 18px;
    font-weight: bold;
    flex: 1;
  }
  .iconBack {
    flex: 0.7;
    margin-left: 20px;
  }
}
.card {
  height: 150px;
  display: flex;

  border-radius: 5px;
  margin: 10px 10px 0px 10px;
  background-color: white;
  .card-main {
    flex: 0.8;
    width: 0%;
    margin: 20px 10px 0px 20px;
    .card-main-title {
      font-size: 20px;
      font-weight: 700;
    }
    .card-main-author{
      color: #b9b9b9;
      font-size: 14px;
    }
    .card-main-desc{
      font-size: 14px;
    }
  }
  .image {
    margin: 20px 20px 0px 0px;
    flex: 0.2;
    height: 100px;
    width: 100px;
  }
}
.van-nav-bar {
  background-color: #64b587;

  .van-nav-bar__title {
    color: white;
    font-weight: bold;
  }
  .van-icon {
    color: white;
  }
}
</style>